//
//  CLModifyEmailViewController.m
//  CarLifes
//
//  Created by yu on 2017/6/25.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import "CLModifyEmailViewController.h"
#import "NSString+JudgeString.h"

@interface CLModifyEmailViewController ()

@end

@implementation CLModifyEmailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"修改邮箱";
    
    self.textField.placeholder = @"邮箱";
    
    self.textField.text = self.user.email;
}

- (void)submitAction
{
    [self.textField resignFirstResponder];
    
    if ([self.textField.text isEqualToString:@""] || [NSString valiEmail:self.textField.text] == NO) {
        [MBProgressHUD showToast:@"请输入正确的邮箱！"];
        return;
    }
    
//    [self.hud show:YES];
    [JDStatusBarNotification showWithStatus:@"正在保存" styleName:JDStatusBarStyleDefault];
    [self.requestTool updateUserInfoName:@"" email:self.textField.text mobile:@"" success:^{
//        [self.hud hide:YES];
        [JDStatusBarNotification showWithStatus:@"保存成功" dismissAfter:2.0 styleName:JDStatusBarStyleSuccess];
        [self.navigationController popViewControllerAnimated:YES];
    } failure:^(NSError *error) {
//        [self.hud hide:YES];
//        [self toast:error.description];
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
